#!/bin/bash
x=$(pgrep -x "runtest.sh" | wc -l)
if [ "$x" -gt "2" ]; then
    echo "### runtest.sh is already running!!"
    exit 1
fi
x=$(pgrep -x "validate.sh" | wc -l)
if [ "$x" -gt "2" ]; then
    echo "### validate.sh is running!!"
    exit 1
fi
if [ -f "/home/pi/miniconda3/bin/activate" ]; then
  export PATH="/home/pi/miniconda3/bin:$PATH"
  source activate py34 > /dev/null 2>&1
fi
export TERM=xterm-mono

cd @TARGET_DIR@
if [ -d "build" ]; then
    rm -rf build
fi
mkdir build && cd build
cmake ..
make
cd ..
export DISPLAY=:0
echo running python3 demo.py @LABELS@ --compiled_model @COMPILED_MODEL@ --image coffeemug.jpg --iterations @ITERATIONS@ --nogui
python3 demo.py @LABELS@ --compiled_model @COMPILED_MODEL@ --image coffeemug.jpg --iterations @ITERATIONS@ --nogui
echo ==== runtest.sh is finished ====

